package com.syxd.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.syxd.common.service.impl.CrudServiceImpl;
import com.syxd.dao.SysPermissionDao;
import com.syxd.dto.SysPermissionDTO;
import com.syxd.entity.SysPermissionEntity;
import com.syxd.service.SysPermissionService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * 系统权限表
 *
 * @author hr tecsmile@outlook.com
 * @since 1.0.0 2019-07-15
 */
@Service
@Transactional
public class SysPermissionServiceImpl extends CrudServiceImpl<SysPermissionDao, SysPermissionEntity, SysPermissionDTO> implements SysPermissionService {

    @Override
    public QueryWrapper<SysPermissionEntity> getWrapper(Map<String, Object> params){
        String id = (String)params.get("id");

        QueryWrapper<SysPermissionEntity> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(id), "id", id);

        return wrapper;
    }


    @Override
    public List getByRoleId(String roleId) {
        return baseDao.getByRoleId(roleId);
    }
}
